<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="../vue2.js"></script>
    <script>
        // 数据代理
        let number = 99
        let person = {
            name : '洛璃'
        }
        //用defineProperty来添加定义值
        Object.defineProperty(person,'age',{
            get(){
                /* getter
                    返回所添加的值
                */
               return number
            },
            set(value){
                // setter  在设置时就调用
                number = value
            }
        })
        number = 100
        console.log(number);
        /*  */
    </script>
</body>
</html>